package com.example.tvrecyclerview.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.tvrecyclerview.R;
import com.example.tvrecyclerview.fragment.BaseConfigFragment;
import com.example.tvrecyclerview.fragment.DefaultConfigFragment;
import com.example.tvrecyclerview.fragment.FragmentBase;
import com.example.tvrecyclerview.fragment.OtherFragment;

/**
 * @author: njb
 * @date: 2020/9/24 0024 0:15
 * @desc:
 */
public class ConfigurationActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView tvBase,tvDefault,tvOther;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_configuration);
        initView();
    }

    private void initView() {
        tvBase = findViewById(R.id.tv_base);
        tvDefault = findViewById(R.id.tv_default);
        tvOther = findViewById(R.id.tv_other);
        tvBase.setOnClickListener(this);
        tvDefault.setOnClickListener(this);
        tvOther.setOnClickListener(this);
    }

    private void showCurrentFragment(FragmentBase fragment) {
        //showFragment(fragment, true);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_base:
                FragmentBase baseFragment = new BaseConfigFragment();
                showCurrentFragment(baseFragment);
                break;
            case R.id.tv_default:
                FragmentBase defaultFragment = new DefaultConfigFragment();
                showCurrentFragment(defaultFragment);
                break;
            case R.id.tv_other:
                FragmentBase otherFragment = new OtherFragment();
                showCurrentFragment(otherFragment);
                break;
        }
    }
}
